package java21.springboot.controller;

import java.util.Map;
import java.util.concurrent.TimeUnit;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("ping")
public class Ping {

  @GetMapping("echo")
  public Map<String, String> echo(String echo) {
    return Map.of("echo", echo);
  }

  @GetMapping("wait10sEcho")
  public Map<String, String> wait60sEcho(String echo) throws InterruptedException {
    TimeUnit.SECONDS.sleep(10);
    return Map.of("echo", echo);
  }
}
